package com.sky.utils;

import com.sky.entity.User;
import org.springframework.stereotype.Component;

@Component
public class ThreadLocalUtil {
    private static final ThreadLocal<Long> idHolder = new ThreadLocal<>();

        public static void setCurrentUser(Long id) {
        idHolder.set(id);
    }

        public static Long getCurrentUser() {
        return idHolder.get();
    }

    public static void clear() {
        idHolder.remove();
    }
}
